<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title></title>
	<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link href="css/mui.min.css" rel="stylesheet"/>
	<link rel="stylesheet" href="css/style.css" />
	
	<style type="text/css">
		html,body,.mui-content{
			width: 100%;
			height: 100%;
			margin: 0;
			padding: 0;
		}
	</style>
</head>
<body>
	<div class="mui-content login_page">
		<form class="login_retrieval">
			<div class="login_verification">
				<span class="login_phone"></span>
				<input id="UserName" name="UserName" type="text" placeholder="请输入用户名">
			</div>
			<div class="login_verification">
				<span class="login_lock"></span>
				<input id="Password" name="Password" type="password" class="mui-input-clear" placeholder="请输入密码">
			</div>
			<p id="forgetPassword" class="forget_password">忘记密码？</p>
			<button id="login-btn" type="button" class="login_retrieval_btn" onclick="">登录</button>
		</form>
	</div>
	<script src="js/mui.min.js"></script>
	<script src="js/config.js"></script>
	<script src="js/comn.js"></script>
	<script src="js/login.js"></script>
	
	<script type="text/javascript">
		mui.plusReady(function(){
			mui.init();
			
			var state = app.getState();
			if(state.ID){
				openWindow('index.html');
			}
			
			var UserNameBox = document.getElementById('UserName');
			var PasswordBox = document.getElementById('Password');
			/*
			mui('#reg')[0].addEventListener('tap',function(event){
				openWindow('reg.html');
			});
			*/
			mui('#forgetPassword')[0].addEventListener('tap',function(event){
				openWindow('password_retrieval.html');
			});
			
			
 
			mui('#login-btn')[0].addEventListener('tap', function(event) {
				//mui.toast('哈哈');return;
				var loginInfo = {
					UserName: UserNameBox.value,
					Password: PasswordBox.value
				};
				plus.nativeUI.showWaiting();
				app.setState(null);
				app.login(loginInfo, function(err) {
					if (err) {
						plus.nativeUI.toast(err);
						plus.nativeUI.closeWaiting();
						return false;						
					}else{
						plus.nativeUI.closeWaiting();
						plus.nativeUI.toast('登录成功');
						setTimeout(function(){
							openWindow('index.html');
						},2000);
					}
				});
			});
			
		});
		
	</script>
</body
</html>